package com.wn.service.impl;

import cn.hutool.crypto.digest.BCrypt;
import com.wn.mapper.UserMapper;
import com.wn.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author yellow Docter
 * @date 2023 -06-01
 * @desc
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public boolean findUserById(String username, String password) {

        // password  是 明文
        // 加密后的密码
        String pwd = userMapper.findUserByName(username);
        boolean flag = BCrypt.checkpw(password, pwd);
        return flag;
    }
}
